package Basic.day04;

import java.util.Random;
import java.util.Scanner;

public class GenerateExam {
    public static void main(String[] args) {
        //100以内自动生成题目
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入题目数量：");
        int num = sc.nextInt();
        for (int i = 1; i <= num; i++) {
            Random random = new Random();
            int a = random.nextInt(100);
            int b = random.nextInt(100);
            System.out.println(a + "+" + b + "=?" + "请输入答案：");
            int answer = sc.nextInt();
            if (answer == a + b){
                System.out.println("回答正确");
            } else {
                System.out.println("回答错误,正确答案是："+ (a + b));
            }
        }
    }
}
